<template>
	<view>
		<text class="zy-btn" @click="onClick" v-if="size=='normal' || size=='sm'"
			:class="{'normal': size== 'normal', 'sm': size== 'sm', 'hollow':hollow, 'yellow': 'yellow'==color, 'black': 'black'==color, 'gray': 'gray'==color}">
			{{text || content}}
		</text>

		<view class="zy-btn full" @click="onClick" v-if="size=='full'" :class="{'hollow':hollow, 'yellow': 'yellow'==color, 'black': 'black'==color, 'gray': 'gray'==color}" >
			{{text || content}}
		</view>
	</view>
</template>

<script>
	import {
		registerRuntimeCompiler
	} from "vue";
	export default {
		name: "zy-button",
		data() {
			return {
			};
		},
		props: {
			text: {
				type: String,
			},
			content: {
				type: String,
			},
			size: {
				//full normal sm  小----根据字体大小 + padding---控制按钮大小
				type: String,
				default () {
					return 'full'
				}
			},
			// 镂空
			hollow: {
				type: Boolean,
				default () {
					return false
				}
			},
			color: {
				type: String,
				default () {
					return 'main'
				}
			}
		},
		methods: {
			onClick() {
				this.$emit('click')
			}
		}
	}
</script>

<style lang="scss" scoped>
	.zy-btn {
		background-color: $zy-color-main;
		// background: linear-gradient(to right, #06EBD8, #14B9D9);
		color: #fff;
		text-align: center;
		border-radius: 50rpx;
	}

	.hollow {
		border: 2rpx solid $zy-color-main;
		color: $zy-color-main;
		background: rgba(#fff, 0);
	}

	.full {
		font-size: 32rpx;
		height: 88rpx;
		line-height: 88rpx;
		width: 100%;
		font-weight: $zy-font-bold;
	}

	.sm {
		font-size: 20rpx;
		padding: 8rpx 15rpx;
		border-radius: 30rpx;
	}

	.normal {
		font-size: 32rpx;
		padding: 15rpx 45rpx;
		font-weight: $zy-font-bold;
	}
	
	.yellow{
		background-color: #FCB61A;
	}
	.black{
		background-color: #222222;
	}
	.gray{
		background-color: #9796A1;
	}
</style>